package main

import (
	"fmt"
	"github.com/spf13/cobra"
	"go-iot-gateway/internal/serial_cli"
	"os"
	"time"
)

func main() {

	var cstZone = time.FixedZone("CST", 8*3600) // 东八
	time.Local = cstZone

	rootCmd := cobra.Command{Use: "serial-cli"}
	rootCmd.AddCommand(
		serial_cli.VersionCmd(),
		serial_cli.PortsCmd(),
		serial_cli.SendCmd(),
		serial_cli.ConfigCmd(),
	)
	//if len(os.Args) == 1 {
	//	rootCmd.SetArgs([]string{"version"})
	//}
	err := rootCmd.Execute()
	if err != nil {
		fmt.Print(err)
		os.Exit(1)
	}

}
